package Limit.BuffDoll;

public class BuffDoll_DollSkill_Load {
	
	/**
	 * 0.BUFFID
	 * 1.IMG
	 * 2.TIME
	 * 3.HTML
	 * 4.PLACE
	 * 5.RESIDENT
	 */
	private int[][] _SkillInfo;
	private int _Item_ID;
	private int _Count;
	
	public int[][] getSkillInfo(){
		return _SkillInfo;
	}
	
	public void setSkillInfo(int[][] i){
		_SkillInfo = i;
	}
	
	public int getItem_ID(){
		return _Item_ID;
	}
	
	public void setItem_ID(int i){
		_Item_ID = i;
	}
	
	public void cleanPlace(int place){
		int i = 0;
		for (int j = 0; j < getSkillInfo().length ; j++){
			if (getSkillInfo()[j][4] == place){
				i = j;
				break;
			}
		}
		setPlace(0, getSkillInfo()[i][0]);
	}
	
	public void setResident(boolean i, int place){
		if(i)
			_SkillInfo[loadSkillLocFromPlace(place)][5] = 1;
		else
			_SkillInfo[loadSkillLocFromPlace(place)][5] = 0;
	}
	
	public void setPlace(int i, int buffid){
		_SkillInfo[loadSkillLocFromBuffid(buffid)][4] = i;
	}
	
	public int getCount(){
		return _Count;
	}
	
	public void setCount(int i){
		_Count = i;
	}
	
	private int loadSkillLocFromBuffid(int i){
		int k = 0;
		for (int j = 0; j < getSkillInfo().length ; j++){
			if (getSkillInfo()[j][0] == i){
				k = j;
				break;
			}
		}
		return k;
	}
	
	private int loadSkillLocFromPlace(int i){
		int k = 0;
		for (int j = 0; j < getSkillInfo().length ; j++){
			if (getSkillInfo()[j][4] == i){
				k = j;
				break;
			}
		}
		return k;
	}
	
	public boolean checkBuff(int buffid)
	{
		boolean isTrue = false;
		for (int j = 0; j < getSkillInfo().length ; j++){
			if (getSkillInfo()[j][0] == buffid){
				isTrue = true;
				break;
			}
		}
		return isTrue;
	}
	
	public boolean checkBuffWithPlace(int buffid)
	{
		boolean isTrue = false;
		for (int j = 0; j < getSkillInfo().length ; j++){
			if (getSkillInfo()[j][0] == buffid){
				if (getSkillInfo()[j][4] > 0)
					isTrue = true;
				break;
			}
		}
		return isTrue;
	}
}
